import Vue from 'vue'
import VueRouter from 'vue-router'
import rec from '../views/rec/rec.vue'
import hotSong from '../views/hotSong/hotSong.vue'
import search from '../views/search/search.vue'
import index from '../views/index/index.vue'
import mvDetails from '../views/mvDetails/mvDetails.vue'
import showlist from '../views/rec/showlist.vue'
import Detail from '../views/hotSong/Detail.vue'
import start from '@com/searchCom/start.vue'
import underway from '@com/searchCom/underway.vue'
import result from '@com/searchCom/result.vue'
const originalPush = VueRouter.prototype.push
VueRouter.prototype.push = function push(location) {
  return originalPush.call(this, location).catch(err => err)
}
Vue.use(VueRouter)

const routes = [
  {
    path: "/",
    name: "index",
    component: index,
    children:[
      {
        path: "/",
        name: "rec",
        component: rec
      },
      {
        path: "hotSong",
        name: "hotSong",
        component: hotSong
      },
      {
        path: "/search",
        name: "search",
        component: search,
        children:[
          {
            path:"/",
            name:"search",
            component: start
          },
          {
            path:"underway",
            name:"underway",
            component:underway
          },
          {
            path:"result",
            name:"result",
            component:result
          }
        ]
      },
    ]
  },
  {
    path:"/showlist",
    name:"showlist",
    component: showlist
  },
  {
    path:"/detail",
    name:"detail",
    component:Detail
  },
  {
    path:"/mvDetails",
    name:"mvDetails",
    component:mvDetails
  }

]

const router = new VueRouter({
  routes
})

export default router
